/*
 * redmicro all Copyright (c)
 */

/**
 * Created by seeker910 on 2015/5/28.
 *
 * 已取消 不用
 */
Rsd.define('Rsd.Faith.pages.SysSuoShuQiListPage', {
    extend: 'Rsd.view.BaseListPage',
    requires: [],
    gridColumns: [
        {
            "text": "序号",
            "xtype": "index",
            "width": 40,
            "index": 0
        },
        {
            "name": "SuoShuQi",
            "dataIndex": "SuoShuQi",
            "sortable": false,
            "text": "所属期",
            "align":'center',
            "index": 32,
            "exist": true,
            "xtype": "string",
            "width": 70,
            "nobr": true
        },
        {
            "name": "JiaoCun",
            "dataIndex": "JiaoCun",
            "sortable": false,
            "text": "缴存",
            "index": 24,
            "exist": true,
            "xtype": "template",
            format:'format_jc',
            "width": 120
        },
        {
            "name": "ShiYong",
            "dataIndex": "ShiYong",
            "sortable": false,
            "text": "使用",
            subs:[
                {
                    name:'sy_sheng_qin',
                    text:'申请',
                    "xtype": "template",
                    format:'format_sysq',
                },
                {
                    name:'sy_hua_bo',
                    text:'划拨',
                    "xtype": "template",
                    format:'format_syhb'
                }
            ],
            "index": 26,
            "exist": true,
            "width": 200
        },
        {
            "name": "ZengZhi",
            "dataIndex": "ZengZhi",
            "sortable": false,
            "text": "增值",subs:[
                {
                    name:'zz_shou_ru',
                    text:'收入',
                    "xtype": "template",
                    format:'format_zzsr',
                },
                {
                    name:'zz_zhi_chu',
                    text:'支出',
                    "xtype": "template",
                    format:'format_zzzc'
                }
            ],
            "index": 27,
            "exist": true,
            "xtype": "string",
            "width": 120
        },
        {
            "name": "ZhangMuHeSuan",
            "dataIndex": "ZhangMuHeSuan",
            "sortable": false,
            "text": "账目",
            subs:[
                {
                    name:'xiaoqu',
                    text:'小区',
                    "xtype": "template",
                    format:'format_xq'
                },
                {
                    name:'loudong',
                    text:'楼栋',
                    "xtype": "template",
                    format:'format_ld'
                },
                {
                    name:'danyuan',
                    text:'单元',
                    "xtype": "template",
                    format:'format_dy'
                },
                {
                    name:'fenghu',
                    text:'分户',
                    "xtype": "template",
                    format:'format_fh'
                }
                ],
            "index": 30,
            "exist": true,
            "xtype": "string",
            "width": 400,
            "nobr": true
        },
        {
            "name": "FenHuJiXi",
            "dataIndex": "FenHuJiXi",
            "sortable": false,
            "text": "分户计息",
            "index": 22,
            "exist": true,
            "xtype": "template",
            format:'format_lx',
            "width": 120
        },
        {
            "name": "ZhuangTai",
            "dataIndex": "ZhuangTai",
            "sortable": false,
            "text": "状态",
            "index": 20,
            "exist": true,
            "xtype": "enum",
            "enum": {
                "name": "Rsd.Faith.Report.ZhuangMuZhuangTai",
                "items": [
                    {
                        "code": "None",
                        "text": "未设置",
                        "value": -1,
                        color:'grey'
                    },
                    {
                        "code": "JZZ",
                        "text": "记账中",
                        "value": 0
                    },
                    {
                        "code": "YHS",
                        "text": "已扎帐",
                        "value": 1
                    }
                ]
            },
            "width": 70,
            "nobr": true
        },
        {
            "width": 10
        }
    ],
    /*
     * */
    constructor: function (config) {
        config = config || {};
        Rsd.apply(this, config);
        this.dataStore =  Rsd.app.getService('admin.GetReportView');

    },
    load:function load()
    {
        var me = this;
        Rsd.showWaiting(this.id);
        this.callParent();
        setTimeout(function () {
            Rsd.closeWaiting(me.id);
        },1000);

    },
    /*
    * */
    format_jc:function format_jc(row) {
        var btns = [];
        var list = row["JC"];

        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('缴存: 0 笔'));
            btns.push(Rsd.newLine());
        }else{
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 笔'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_sysq:function format_sysq(row) {
        var btns = [];
        var list = row["SY"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('申请: 0 笔'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 笔'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_syhb:function format_syhb(row) {
        var btns = [];
        var list = row["HB"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('拨付: 0 笔'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 笔'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    format_zzsr:function format_zzsr(row) {
        var btns = [];
        var list = row["SR"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 笔'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 笔'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    format_zzzc:function format_zzzc(row) {
        var btns = [];
        var list = row["ZC"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 笔'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 笔'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_xq:function format_xq(row) {
        var btns = [];
        var list = row["XQ"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 个'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 个'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_ld:function format_ld(row) {
        var btns = [];
        var list = row["LD"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 个'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 个'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    format_dy:function format_dy(row) {
        var btns = [];
        var list = row["DY"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 个'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 个'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_fh:function format_fh(row) {
        var btns = [];
        var list = row["FH"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 户'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 户'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_lx:function format_lx(row) {
        var btns = [];
        var list = row["LX"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('未开始计息',80,'red'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 户'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    },
    /*
    * */
    format_zz:function format_zz(row) {
        var btns = [];
        var list = row["ZZ"];
        if(list==null || list.length == 0)
        {
            btns.push(Rsd.text('共: 0 个'));
            btns.push(Rsd.newLine());
        }else
        {
            for(var i in list)
            {
                btns.push(Rsd.text(list[i].Text+': '+list[i].ShuLiang + ' 个'));
                btns.push(Rsd.newLine());
            }
        }

        return btns ;
    }


});

